#!/bin/bash
#source env.sh  #only for test
function create_snapshot_image(){
if [ $# != 1 ]; then
   LOG_MSG  "$* parameter error";
   return 255
fi
local SYSDISK=$1
local BASEIMAGE=""
if [ $VM_OS_TYPE == "minios" ]; then
BASEIMAGE=$BASE_IMAGE_PATH/domU-32bit-FS.img
fi
if [ $VM_OS_TYPE == "centos" ]; then
BASEIMAGE=$BASE_IMAGE_PATH/centos6.img
fi
 
if [ -d $SYSDISK ]; then
	rm -rf $SYSDISK
else
	mkdir -p $SYSDISK
fi
if [ $BASEIMAGE == "" ]
then
   return 255
fi

local DIFFIMAGE=diff.img
LOG_MSG "$BASEIMAGE"
LOG_MSG "$SYSDISK/$DIFFIMAGE"
cp $BASEIMAGE  $SYSDISK/$DIFFIMAGE >/dev/null 2>&1
if [ $? -ne 0 ];then
   LOG_MSG "create snapshot failed"
   return 255;
fi
}
